package cn.gson.fengboot.model.pojos;

import javax.persistence.*;
import java.util.Collection;
import java.util.Objects;

@Entity
@Table(name = "qtype", schema = "springboot", catalog = "")
public class QtypeEntity {
    private int typeId;
    private String typeName;
    private Integer parendtId;
    private int categoryLevel;
    private Collection<Qmodel> qmodelsid;
    private Collection<Qproductdetail> qproductdetailsty;


    @OneToMany(mappedBy = "typeId")
    public Collection<Qproductdetail> getQproductdetailsty() {
        return qproductdetailsty;
    }
    public void setQproductdetailsty(Collection<Qproductdetail> qproductdetailsty) {
        this.qproductdetailsty = qproductdetailsty;
    }



    @OneToMany(mappedBy = "typeId")
    public Collection<Qmodel> getQmodelsid() {
        return qmodelsid;
    }
    public void setQmodelsid(Collection<Qmodel> qmodelsid) {
        this.qmodelsid = qmodelsid;
    }

    @Id
    @Column(name = "type_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    public int getTypeId() {
        return typeId;
    }

    public void setTypeId(int typeId) {
        this.typeId = typeId;
    }

    @Basic
    @Column(name = "type_name")
    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    @Basic
    @Column(name = "parendt_id")
    public Integer getParendtId() {
        return parendtId;
    }

    public void setParendtId(Integer parendtId) {
        this.parendtId = parendtId;
    }

    @Basic
    @Column(name = "category_level")
    public int getCategoryLevel() {
        return categoryLevel;
    }

    public void setCategoryLevel(int categoryLevel) {
        this.categoryLevel = categoryLevel;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        QtypeEntity that = (QtypeEntity) o;
        return typeId == that.typeId &&
                Objects.equals(typeName, that.typeName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(typeId, typeName);
    }

    @Override
    public String toString() {
        return "QtypeEntity{" +
                "typeId=" + typeId +
                ", typeName='" + typeName + '\'' +
                ", qmodelsid=" + qmodelsid +
                '}';
    }

    public QtypeEntity(int typeId) {
        this.typeId = typeId;
    }

    public QtypeEntity() {
    }
}
